package cn.nawang.ebeim.ui.util;

public class ApiUrl {

  public static String apiServer = PropertiesUtil.read("apiServer");
  public static String host = PropertiesUtil.read("host");
  public static int port = Integer.parseInt(PropertiesUtil.read("port"));
  public static final String TOKEN = "&token=tokennawang";

  public static RestUtil createRestUtil() {
    return new RestUtil(host, port);
  }

  public static String getDatasourceList(String userId,String mac,String isMac) {
    StringBuffer sb=new StringBuffer();
    sb.append(ApiConstants.URI_DATASOURCES_USERID).append("?userId=").append(userId).append("&mac=").append(mac).append("&isMac=").append(isMac).append(TOKEN);
    RestUtil rest = createRestUtil();
    System.out.println(sb.toString());
    return rest.doGet(sb.toString());
  }
  public static String getUserInfoPart(String userId,String spaceSize,String labId) {
    StringBuffer sb=new StringBuffer();
    sb.append(ApiConstants.URI_UserInfoPart_USERID).append("?id=").append(userId).append("&labId=").append(labId).append("&spaceSize=").append(spaceSize).append(TOKEN);
    RestUtil rest = createRestUtil();
    System.out.println(sb.toString());
    return rest.doGet(sb.toString());
  }
  
  public static String getMonitorPlan(String userId,String mac,String nativeSel,String useSel,String onlineSel) {
    StringBuffer sb=new StringBuffer();
    sb.append(ApiConstants.URI_DATASOURCE_PLAN).append("?id=").append(userId).append("&mac=").append(mac).append("&nativeSel=").append(nativeSel).append("&useSel=").append(useSel).append("&onlineSel=").append(onlineSel).append(TOKEN);
    RestUtil rest = createRestUtil();
    System.out.println(sb.toString());
    return rest.doGet(sb.toString());
  }
  public static String getWarnList(String userId,String type,String level,String begin,String end) {
    StringBuffer sb=new StringBuffer();
    sb.append(ApiConstants.URI_WARN_LIST).append("?id=").append(userId).append("&type=").append(type).append("&level=").append(level).append("&begin=").append(begin).append("&end=").append(end).append(TOKEN);
    RestUtil rest = createRestUtil();
    System.out.println(sb.toString());
    return rest.doGet(sb.toString());
  }
  
}
